package com.intxt.bbs.interceptor;


import com.intxt.bbs.model.User;
import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;

/**
 * Created bbs-com.intxt.bbs.interceptor
 * User: GouLin
 * Date: 15/2/28
 * Time: 下午11:15
 * To change this template use File | Settings | File Templates.
 */
public class AdminInterceptor implements Interceptor {
    @Override
    public void intercept(ActionInvocation actionInvocation) {
        User u = (User)actionInvocation.getController().getSession().getAttribute("user");
        if(u!= null && u.getInt("user_group_id")==2){
            actionInvocation.invoke();
        }else{
            actionInvocation.getController().redirect("/topic");
        }
    }
}
